<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2" />
    <title>线索</title>
</head>

<body>
    <div class="main-body">
        <div class="page-wrapper">
            <!-- Page-header start -->
            <div class="page-header">
                <div class="page-header-title">
                    <h4>线索列表</h4>
                </div>

                <div class="page-header-breadcrumb">
                    <ul class="breadcrumb-title">
                        <li class="breadcrumb-item">
                            <a href="/salesDashboard/index">
                                <i class="icofont icofont-home"></i>
                            </a>
                        </li>
                        <li class="breadcrumb-item"><a href="#!">线索列表</a>
                        </li>
                    </ul>
                </div>
            </div>
            <!-- Page-header end -->
            <!-- Page-body start -->
            <div class="page-body">
                <!-- Hover table card start -->
                <div class="card">
                    <div class="card-header">
                        <h5>线索列表</h5>

                        <div class="card-header-right">
                            %{-- <i class="icofont icofont-rounded-down"></i> --}%
                            <g:link action="create"><i class="ion-plus"></i> 新增</g:link>
                        </div>
                    </div>

                    <div class="card-block">

                        <div class="dt-responsive table-responsive">
                            <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">

                                <g:form method="POST" action="searchLead">
                                <div class="row m-0">
                                    <div class="col-md-10 p-l-0">
                                        <div id="dom-jqry_filter" class="text-left">

                                            <label class="block">
                                                <div class="form-group row">
                                                    <div class="col-md-3">
                                                        <input type="text" class="form-control" placeholder="姓名" name="fullName" id="fullName" value="${params?.fullName}">
                                                    </div>
                                                    <div class="col-md-3">
                                                        <!-- <input type="text" class="form-control" placeholder="部门" name="department" id="department" value="${params?.department}"> -->
                                                        <g:select class="form-control" name="department" id="department" optionValue="name"
                                                        optionKey="name"
                                                        from="${com.next.Department.list()}" value="${params?.department}"
                                                        noSelection="${['': '部门']}"/>
                                                    </div>
                                                    <div class="col-md-3">
                                                        <!-- <input type="text" class="form-control" placeholder="销售人员" name="owner" id="owner" value="${params?.owner}"> -->
                                                        <g:select class="form-control" name="owner" id="owner" optionValue="fullName"
                                                        optionKey="fullName"
                                                        from="${com.next.User.list()}" value="${params?.owner}"
                                                        noSelection="${['': '销售人员']}"/>
                                                    </div>

                                                    <div class="col-md-3">
                                                     <%-- <input type="text" class="form-control" placeholder="评级" name="rating" id="rating" value="${params?.rating}"> --%>
                                                     <g:select class="form-control" name="rating" id="rating" optionValue="name"
                                                     optionKey="name"
                                                     from="${com.next.LeadRating.list()}" value="${params?.rating}"
                                                     noSelection="${['': '评级']}"/>
                                                 </div>
                                             </div>

                                                <div class="form-group row">
                                                    <div class="col-md-3">
                                                        <%-- <input type="text" class="form-control" placeholder="状态" name="status" id="status" value="${params?.status}"> --%>
                                                        <g:select class="form-control" name="status" id="status" optionValue="name"
                                                        optionKey="name"
                                                        from="${com.next.LeadStatus.list()}" value="${params?.status}"
                                                        noSelection="${['': '状态']}"/>
                                                    </div>

                                                    <div class="col-md-3">
                                                        <input type="text" valctrl="startTime" value="${params?.startTime}" placeholder="开始时间" class="form-control form_date">
                                                        <input type="hidden" id="startTime" name="startTime" value="date.struct">
                                                        <input type="hidden" id="startTime_day" name="startTime_day" value="">
                                                        <input type="hidden" id="startTime_month" name="startTime_month" value="">
                                                        <input type="hidden" id="startTime_year" name="startTime_year" value="">
                                                    </div>
                                                    <div class="col-md-3">
                                                        <input type="text" valctrl="endTime" value="${params?.endTime}" placeholder="结束时间" class="form-control form_date">
                                                        <input type="hidden" id="endTime" name="endTime" value="date.struct">
                                                        <input type="hidden" id="endTime_day" name="endTime_day" value="">
                                                        <input type="hidden" id="endTime_month" name="endTime_month" value="">
                                                        <input type="hidden" id="endTime_year" name="endTime_year" value="">
                                                    </div>
                                                </div>


                                            </label>
                                        </div>

                                    </div>

                                    <div class="col-md-2 p-r-0 dt-buttons text-right">
                                        <button class="btn btn-inverse btn-sm btn-squeare" type="submit"><i class="fa fa-search"></i></button>
                                        <button class="btn btn-inverse btn-sm btn-squeare" type="button" id="resetBtn"><i class="fa fa-refresh"></i></button>
                                    </div>
                                </div>
                            </g:form>
                            %{--
                            <g:form method="POST" action="exportLead">
                            <div class="row m-0">
                                <input type="hidden" class="form-control" placeholder="姓名" name="fullName" id="exportFullName" value="${params?.fullName}">
                                <input type="hidden" class="form-control" placeholder="文件类型" name="f" value="excel">
                                <input type="hidden" class="form-control" placeholder="后缀" name="extension" value="xls">

                                <div class="col-md-12 p-r-0 dt-buttons text-right">
                                    <button class="btn btn-success btn-mini" type="submit"><i class="icofont icofont-search"></i>导出
                                    </button>
                                </div>
                            </div>
                        </g:form>
                        --}%
                        <div class="row m-0">
                            <div class="col-xs-12 col-sm-12">
                                <table id="dom-jqry" class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                          <g:sortableColumn property="id" title="${message(code: 'lead.id.label', default: '编号')}"></g:sortableColumn>
                                            <g:sortableColumn property="company" title="${message(code: 'lead.company.label', default: '公司')}"></g:sortableColumn>
                                            <g:sortableColumn property="fullName" title="${message(code: 'lead.fullName.label', default: '姓名')}"></g:sortableColumn>
                                            <g:sortableColumn property="industry" title="${message(code: 'lead.industry.label', default: '行业')}"></g:sortableColumn>
                                            <g:sortableColumn property="status" title="${message(code: 'lead.status.label', default: '状态')}"></g:sortableColumn>
                                            <g:sortableColumn property="user" title="${message(code: 'lead.user.label', default: '所有人')}"></g:sortableColumn>
                                            <g:sortableColumn property="createBy" title="${message(code: 'lead.createBy.label', default: '创建人')}"></g:sortableColumn>
                                            <g:sortableColumn property="modifyBY" title="${message(code: 'lead.modifyBY.label', default: '修改人')}"></g:sortableColumn>
                                            <g:sortableColumn property="createdDate" title="${message(code: 'lead.createdDate.label', default: '创建时间')}"></g:sortableColumn>
                                            <g:sortableColumn property="createdDate" title="${message(code: 'lead.modifieddDate.label', default: '修改时间')}"></g:sortableColumn>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <g:each in="${leadList}">
                                        <tr>
                                          <td>
                                              <g:link action="show" id="${it?.id}">${it?.id}</g:link>
                                          </td>
                                            <td>
                                                <g:link action="show" id="${it?.id}">${it?.company}</g:link>
                                            </td>
                                            <td>${it?.fullName}</td>
                                            <td>${it?.industry}</td>
                                            <td>${it?.status?.name}</td>
                                            <td>${it?.user}</td>
                                            <td>${it?.createBy}</td>
                                            <td>${it?.modifyBy}</td>
                                            <td>
                                                <g:formatDate format="yyyy-MM-dd HH:mm:ss" date="${it?.createdDate}" />
                                            </td>
                                            <td>
                                                <g:formatDate format="yyyy-MM-dd HH:mm:ss" date="${it?.modifiedDate}" />
                                            </td>
                                        </tr>
                                    </g:each>
                                </tbody>
                            </table>
                        </div>
                    </div>

                    <div class="row m-0">
                        <div class="col-xs-12 col-sm-12 col-md-5">
                            <div class="dataTables_info" id="dom-jqry_info" role="status" aria-live="polite">每页10条，共${leadCount}条</div>
                        </div>
                        <div class="col-xs-12 col-sm-12 col-md-7">
                            <div class="dataTables_paginate" id="dom-jqry_paginate">
                                <div class="pagination">
                                    <g:paginate total="${leadCount ?: 0}" params="${params}" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>

        </div>
    </div>
</div>
</div>
</div>

<g:javascript>
$(function() {
$("#resetBtn").click(function() {
$("#fullName").val("");
$("#department").val("");
$("#select2-department-container").text("部门");
$("#owner").val("");
$("#select2-owner-container").text("销售人员");
$("#rating").val("");
$("#select2-rating-container").text("评级");
$("#status").val("");
$("#select2-status-container").text("状态");
$(".form_date").val("");
$(".form_date").change();

})
});
</g:javascript>
</body>

</html>
